using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
// 处理角色移动输入
public class MoveInputReader
{
    private PlayerInputControl playerInput;
    // private MouseInputControl MouseInput;
    public Vector3 inputDirection;
    public MouseInputReader mouseInputReader;
    public void OnEnable() => playerInput.Enable();
    public void OnDisable() => playerInput.Disable();
    private Vector3 _forward;
    public Vector3 Forward
    {
        get => _forward;
        set => _forward = value;
    }
    public MoveInputReader(MouseInputReader mouseInput)
    {
        mouseInputReader = mouseInput;
        playerInput = new PlayerInputControl();
        // MouseInput = new MouseInputControl();
    }


    public void Update()
    {
        inputDirection = playerInput.GamePlay.action.ReadValue<Vector3>();
        PlayerDirection();
    }
    void PlayerDirection()
    {
        Forward = new Vector3(inputDirection.x, inputDirection.y, 0f);
    }

    public bool IsMovePressed()
    {
        if (inputDirection.x != 0)
        {
            return true;
        }
        return false;
    }

    internal bool IsJumpPressed()
    {
        if (playerInput.GamePlay.jump.ReadValue<float>() > 0)
        {
            return true;
        }
        return false;
    }

    internal bool IsShiftMovePressed()
    {
        if (playerInput.GamePlay.shift.ReadValue<float>() > 0)
        {
            return true;
        }
        return false;
    }
}
